#include <iostream>
using namespace std;
typedef long long LL;
const int N = 1e4 + 10;
LL a[N], b[N];
LL n;
LL m = 1e10;
LL find(int x)
{
    LL ret = 0;
    LL t = 0;
    for (int i = 1;i <= n;i++)
    {
        ret += a[i] / x;
        t += b[i];
    }
    if (t > ret) return 1;//取大了
    else if (t == ret) return 0;//合理范围
    else return -1;
}
LL min(LL x, LL y)
{
    if (x < y) return x;
    else return y;
}
int main()
{
    // 请在此输入您的代码
    cin >> n;

    for (int i = 1;i <= n;i++)
    {
        cin >> a[i] >> b[i];
        m = min(m, a[i]);
    }
    //查找为1-m
    LL l = 1;LL r = m;
    //二分查找这个左右区间都得给他找到
    while (l < r)
    {
        LL mid = (l + r) / 2;
        if (find(mid)>=0) r = mid;
        else l = mid + 1;
    }
    cout << l << " ";
    l = 1;r = m;//别忘了重置
    //做到这里发现两个答案都一样，仔细检查了一下第二个策略没有问题，突然意识到是没有重置l,r
    while (l < r)
    {
        LL mid = (l + r +1) / 2;
        if (find(mid)<=0) l = mid;
        else r = mid - 1;
    }
    cout << l << " ";
    return 0;
}